import React, { Component } from "react";

// 7. 页面组件中导入 store
import store from './store/transit'

export default class Page1 extends Component {
    state = {
        title: '啊哈哈哈哈'
    }
    render() {
        

        const count = store.getState().count;
        
        return <>
            <h1>Page1 -- {count}</h1>
            <button onClick={()=>{
                //  修改全局数据
                //  想办法触发 add
                store.dispatch({type: 'add'})
            }}>点击加1</button>

            <button onClick={()=>{
                store.dispatch({type: 'addNum', payload: 5})
            }}>加指定数</button>
        </>
    }
}